#ifndef FILEUTILS_H
#define FILEUTILS_H

#include <vector>
using namespace std;

class File
{
    FILE * f;
public:
    File();
    File(FILE *aFileHandle);
    File(const char *aFilename, const char *aFileOpenTypes);
    virtual ~File();
    virtual int readbyte();
    virtual int  readword();
    virtual int  readint();
    virtual void readchars(char * dst, int count);
    virtual void writebyte(char data);
    virtual void writeword(short data);
    virtual void writeint(int data);
    virtual void writechars(const char * src, int count);
    virtual int tell();
    virtual void seek(int pos);
};

class MemoryFile : public File
{
public:
    vector<char> mData;
    int mDataIdx;
    MemoryFile();
    ~MemoryFile();
    virtual int readbyte();
    virtual int readword();
    virtual int readint();
    virtual void writebyte(char data);
    virtual void writeword(short data);
    virtual void writeint(int data);
    virtual int tell();
    virtual void seek(int pos);
};
#endif
